# lib/tasks/cron_print.rake
# prints a set of cron jobs that should be installed by the admin using crontab -e

namespace :cron do
  desc "Print cron jobs to be installed."
  task :print => :environment do
    every_5 = "0,5,10,15,20,25,30,35,40,45,50,55"

    jobs = ["#{every_5} * * * * cd #{Rails.root}; export GEM_HOME=$PWD/../gems; export PATH=$PATH:$PWD/../bin; ruby lib/scripts/crawler-bootstrap.rb #{Rails.env} 2>&1| sed \"s/^/$(date)  /\" >> log/crawler.log"] 
    
    puts "Copy the following lines into your crontab by running crontab -e and then copy pasting into your editor.\n-----\n"
    jobs.each{|j| puts j}
    puts "-----\n"
  end
end
